package org.dairy.farms.nandana.core.security.userdetails;

/**
 * Created by IntelliJ IDEA.
 * User: gduggira
 * Date: Jun 17, 2011
 * Time: 4:53:30 PM
 */
public class NandanaGrantedAuthorityImpl implements NandanaGrantedAuthority{
    private String authority;
    private String farmName;
    private Long farmId;

    public NandanaGrantedAuthorityImpl(String authority,String farmName,
                                        Long farmId){
        this.authority = authority;
        this.farmName = farmName;
        this.farmId = farmId;
    }
    public String getAuthority() {
        return authority;
    }
    public String getFarmName(){
        return farmName;
    }

    public Long getFarmId() {
        return farmId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof NandanaGrantedAuthorityImpl)) return false;

        NandanaGrantedAuthorityImpl that = (NandanaGrantedAuthorityImpl) o;

        if (authority != null ? !authority.equals(that.authority) : that.authority != null) return false;
        if (farmId != null ? !farmId.equals(that.farmId) : that.farmId != null) return false;
        if (farmName != null ? !farmName.equals(that.farmName) : that.farmName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = authority != null ? authority.hashCode() : 0;
        result = 31 * result + (farmName != null ? farmName.hashCode() : 0);
        result = 31 * result + (farmId != null ? farmId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "NandanaGrantedAuthorityImpl{" +
                "authority='" + authority + '\'' +
                ", farmName='" + farmName + '\'' +
                ", farmId=" + farmId +
                '}';
    }
}
